import React from 'react'
import { FlatList } from 'react-native'
import { ChatItem } from './chat-item'

export const Chats = ({ chats, self, loading, onRefresh }) => (
  <FlatList
    data={chats}
    refreshing={loading}
    onRefresh={onRefresh}
    keyExtractor={x => x.id}
    renderItem={({ item }) => <ChatItem chat={item} self={self} />}
  />
)
